package robren.data;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

import robren.domain.Inscripcion;

public class JDBCPagoDAO implements IPagoDAO {

	private Connection conn;

	public JDBCPagoDAO(){
		conn = ConnectionManager.getInstance().checkOut();
	}
	
	 protected void finalize() {
	        ConnectionManager.getInstance().checkIn(conn);
	    }
	 
	public void insertaPrecio(Double Pago,String oid) {
		
    	String sql = "INSERT INTO pago (Pago,OID) VALUES (?,?)";
    	PreparedStatement stmt = null;
    	try {
    		stmt = conn.prepareStatement(sql);
    		
    		stmt.setDouble(1, Pago);
            stmt.setString(2, oid);
            
            stmt.executeUpdate();

        } catch (SQLException e) {
            System.out.println("Message: " + e.getMessage());
            System.out.println("SQLState: " + e.getSQLState());
            System.out.println("ErrorCode: " + e.getErrorCode());
        } finally {
            try {
                if (stmt != null) {
                    stmt.close();
                }
            } catch (SQLException e) {
            }
        }

    }

}
